package com.jeesite.modules.dataScreen.web;

import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jeesite.modules.dataScreen.service.EventOrderService;
import com.jeesite.modules.dataScreen.web.dto.UrbanMovementDto;
import com.jeesite.modules.dataScreen.web.vo.EventOrderProcessVo;
import com.jeesite.modules.dataScreen.web.vo.Result;
import com.jeesite.modules.dataScreen.web.vo.UrbanMovementDetailVo;
import com.jeesite.modules.dataScreen.web.vo.UrbanMovementVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "三级城运中心")
@RestController
@RequestMapping("/urbanMovement")
public class UrbanMovementApi {

    @Resource
    private EventOrderService eventOrderService;

    @GetMapping("/list")
    @ApiOperation(value = "城运事件列表")
    public Result<IPage<UrbanMovementVo>> list(UrbanMovementDto dto) {
        return Result.OK(eventOrderService.list(dto));
    }

    @GetMapping("/detail")
    @ApiOperation(value = "城运事件明细列表")
    public Result<List<EventOrderProcessVo>> detailList(@RequestParam String eventNum) {
        return Result.OK(eventOrderService.detailList(eventNum));
    }

    @GetMapping("/detailNew")
    @ApiOperation(value = "城运事件详情")
    @ApiImplicitParam(name = "eventNum", value = "事件ID", required = true, dataType = "String")
    public Result<UrbanMovementDetailVo> detail(@RequestParam String eventNum) {
        return Result.OK(eventOrderService.detail(eventNum));
    }

    @GetMapping("/statusCount")
    @ApiOperation(value = "状态对应数量")
    public Result<JSONObject> eventOrderCount(@RequestParam(required = false) String keywords) {
        return Result.OK(eventOrderService.eventOrderCount(keywords));
    }

    @GetMapping("/levelCount")
    @ApiOperation(value = "等级对应数量")
    public Result<JSONObject> levelCount() {
        return Result.OK(eventOrderService.levelCount());
    }
}
